<template>
	<view class="">
		<view class="" style="display: flex;justify-content: space-between;padding: 20rpx;border-bottom: 1rpx solid #ccc;" @click="goTx">
			<view class="">
				提现
			</view>
			<view class="" style="display: flex;">
				<!-- <view class="">
					{{yuer}}元
				</view> -->
				<u-icon name="arrow-right" color="#000" size="28"></u-icon>
			</view>
		</view>
		<view class="" style="display: flex;justify-content: space-between;padding: 20rpx;border-bottom: 1rpx solid #ccc;" @click="gchengeMyStore">
			<view class="">
				开始营业/打烊
			</view>
			<u-icon name="arrow-right" color="#000" size="28"></u-icon>
		</view>
		<view class="" style="display: flex;justify-content: space-between;padding: 20rpx;border-bottom: 1rpx solid #ccc;" @click="gomyshoplist">
			<view class="">
				管理商品
			</view>
			<u-icon name="arrow-right" color="#000" size="28"></u-icon>
		</view>
		
		<view v-if="MoneyShows == true" class="" style="width: 100vw;height: 100vh;background-color: rgba(0,0,0,.5);position: fixed;top: 0;left: 0;">
			<view class="" style="width: 600rpx;margin: 100rpx auto;background-color: #fff;padding: 10rpx;">
				<view class="" style="width: 100%;height: 50rpx;">
					
				</view>
				<view class="" style="margin-top: 50rpx;display: flex;align-items: center;">
					<view class="">
						提现金额:
					</view>
					<input v-model="txMoney" style="border: 1rpx solid #ccc;width: 300rpx;margin:0 auto;height: 50rpx;" type="text" placeholder="请输入要提现的金额" />
					
				</view>
				<view class="" style="margin-top: 50rpx;display: flex;align-items: center;">
					<view class="">
						银行卡号:
					</view>
					<input v-model="bank_account" style="border: 1rpx solid #ccc;width: 300rpx;margin:0 auto;height: 50rpx;" type="text" placeholder="请输入银行卡号" />
					
				</view>
				<view class="" style="margin-top: 50rpx;display: flex;align-items: center;">
					<view class="">
						银行名称:
					</view>
					<input v-model="bank_name"  style="border: 1rpx solid #ccc;width: 300rpx;margin:0 auto;height: 50rpx;" type="text" placeholder="请输入银行名称" />
					
				</view>
				<view class="" style="margin-top: 50rpx;display: flex;align-items: center;">
					<view class="">
						支行名称:
					</view>
					<input v-model="bank_address"   style="border: 1rpx solid #ccc;width: 300rpx;margin:0 auto;height: 50rpx;" type="text" placeholder="例如长江路支行" />
					
				</view>
				<view class="" style="margin-top: 50rpx;display: flex;align-items: center;">
					<view class="">
						真实姓名:
					</view>
					<input v-model="real_name" style="border: 1rpx solid #ccc;width: 300rpx;margin:0 auto;height: 50rpx;" type="text" placeholder="请输入真实姓名" />
					
				</view>
				
				<view class="" style="display: flex;justify-content: space-around;margin-top: 50rpx;">
					<view class="">
						<button @click="noMoney">取消</button>
					</view>
					<view class="">
						<button @click="yesMoney">确定</button>
					</view>
				</view>
			</view>
			
			
		</view>
		
		
		
	</view>
</template>

<script>
	export default {
		onShow() {
			this.yuer = uni.getStorageSync('balance')
		},
		data(){
			return{
				MoneyShows:false,
				txMoney:'',
				bank_account:'',
				bank_name:'',
				bank_address:'',
				real_name:'',
				balance:'',
				yuer:'',
				
				
				
			}
		},
		methods:{
			getUserInfo(){
				this.$req('GET',this.$api.getUser,{
					id:uni.getStorageSync('userId')
				}).then(ress =>{
					
					this.balance = ress.data.store.balance
					
					uni.setStorageSync('balance',this.balance)
					this.yuer = uni.getStorageSync('balance')
				})
			},
			goTx(){
				// moneyTi
				// this.MoneyShows = true
				uni.navigateTo({
					url: '/select-pkg/mymoney/mymoney'
				})
			},
			noMoney(){
				this.MoneyShows = false
			},
			yesMoney(){
				this.$req('POST',this.$api.moneyTi,{
					user_id:uni.getStorageSync('userId'),
					store_id:uni.getStorageSync('storId'),
					amount:this.txMoney,
					bank_name:this.bank_name,
					bank_account:this.bank_account,
					bank_address:this.bank_address,
					real_name:this.real_name
					
					
				}).then(res =>{
					console.log(res,'查看提醒成功与否')
					if(res.status == 200){
						uni.$u.toast('提现申请成功')
						this.getUserInfo()
						this.txMoney = ''
						this.bank_name = ''
						this.bank_account = ''
						this.bank_address = ''
						this.real_name = ''
						this.MoneyShows = false
						
					}else{
						uni.$u.toast(res.message)
						this.txMoney = ''
						this.bank_name = ''
						this.bank_account = ''
						this.bank_address = ''
						this.real_name = ''
						this.MoneyShows = false
					}
					
				}) 
			},
			gchengeMyStore(){
				// console.log('打样')
				
				this.$req('POST',this.$api.storeOpens,{
					store_id:uni.getStorageSync('storId')
				}).then(res =>{
					console.log(res,'查看res是更改成功与否')
					uni.$u.toast(res.message)
				})
				
			},
			gomyshoplist(){
				uni.navigateTo({
					url: '/free-pkg/editmyshoplist/editmyshoplist'
				})
			}
			
		}
	}
	
</script>

<style>
	page {
		background: #f6f5f7;
	}
	
	
	
	
</style>